package cn.scnu.configuration;

import com.github.benmanes.caffeine.cache.Caffeine;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@Configuration
public class CacheConfig {

    @Bean
    public com.github.benmanes.caffeine.cache.Cache<String, Object> caffeineCache() {
        return Caffeine.newBuilder()
                .expireAfterWrite(24, TimeUnit.HOURS) // 设置缓存项的过期时间为10分钟
                .maximumSize(100) // 设置缓存的最大容量
                .build();
    }
}
